import {
  Toast
} from "vant";
export default {
  components: {},
  props: {},
  data() {
    return {
      list: [],
      tabs: ['大区', '小区'],
      current: 0,
      myYeji: 0,//我的业绩
      teamYeji: 0, //团队业绩
      teamNum: 0, //团队人数
      teamNumA: 0, //A区团队人数
      teamNumB: 0, //B区团队人数
      aYeji: 0, //A区业绩
      bYeji: 0, //B区业绩
    };
  },
  activated() {
    this.getData();
  },

  methods: {
    changeTab(index){ 
      this.current = index;
      this.getData();
    },
    getData() {
      var that = this;
      $http.post("GuxinyuDajiankang.getTeamYeji", {
        uid: localStorage.getItem("uid") ? localStorage.getItem("uid") : localStorage.getItem("mid")
      }).then(res => {
        console.log(res, 'my_team');
        if (res.result == 1) {
          var obj = res.data;
          that.myYeji = obj.myYeji ? Number(obj.myYeji).toFixed(2) : '0.00';
          that.teamNum = obj.da_order_user.total + obj.xiao_order_user.total;
          that.aYeji = obj.da_order_num > 0 ? parseFloat(obj.da_order_num).toFixed(2) : '0.00';
          that.bYeji = obj.xiao_order_num > 0 ? parseFloat(obj.xiao_order_num).toFixed(2) : '0.00';
          that.teamYeji = Number(that.aYeji) + Number(that.bYeji);
          that.list = that.current == 0 ? obj.da_order_user.data : obj.xiao_order_user.data;
          that.teamNumA = obj.da_order_user.data.length;
          that.teamNumB = obj.xiao_order_user.data.length;
        }


      });

    }
  }
};